#!/bin/bash
# curl -s http://wuyou.run/monitor/zabbix/add_items.sh|bash


# Test： /usr/local/zabbix/bin/zabbix_get  -s 18.167.1.1 -k ports.discovery


###  端口发现
rm  /etc/zabbix/zabbix_agentd.d/{ports.discovery.py,ports.conf} -f
wget -P /etc/zabbix/zabbix_agentd.d   http://wuyou.run/monitor/zabbix/ports.discovery.py
wget -P /etc/zabbix/zabbix_agentd.d   http://wuyou.run/monitor/zabbix/ports.conf






### zabbix add sudoer ###
(grep "zabbix" -lr /etc/sudoers)||cat >> /etc/sudoers << EOF
zabbix ALL=(ALL)    NOPASSWD: /bin/netstat
Defaults:zabbix !requiretty
EOF

chmod +x  /etc/zabbix/zabbix_agentd.d/*
systemctl restart zabbix-agent